C_FILE := $(wildcard *.c)
C_UDP_FILE := $(wildcard ../udp/*.c)
C_IP_FILE := $(wildcard ../ip/*.c)
C_ARP_FILE := $(wildcard ../arp/*.c)
C_UTIL_FILE := $(wildcard ../common/*.c)
O_UDP_FILE := $(patsubst %.c,%.o,$(filter ../udp/udp%.c,$(C_UDP_FILE)))
O_IP_FILE := $(patsubst %.c,%.o,$(filter ../ip/ip%.c,$(C_IP_FILE)))
O_ARP_FILE := $(patsubst %.c,%.o,$(filter ../arp/arp%.c,$(C_ARP_FILE)))
O_UTIL_FILE := $(patsubst %.c,%.o,$(filter ../common/util%.c,$(C_UTIL_FILE)))
O_C_FILE := $(patsubst %.c,%.o,$(C_FILE))

all: send_udp.out

send_udp.out: $(O_UTIL_FILE) $(O_UDP_FILE) $(O_UTIL_FILE) $(O_C_FILE) $(C_IP_FILE)
	gcc $^ -o $@

%.o: %.c
	gcc -c $^ -o $@